'use strict';

const Service = require('egg').Service;

class SkillsService extends Service {

  /**
   * 创建
   */
  async create(data) {
    const { Me } = this.ctx.model;
    await Me.addSkills(data);
  }

  /**
   * 更新数据
   */
  async update(id, data) {
    const { Me } = this.ctx.model;
    return await Me.updateSkills(id, data);
  }

  /**
   * 删除数据
   */
  async destroy(id) {
    const { Me } = this.ctx.model;
    return await Me.removeSkills(id);
  }

  /**
   * 获取列表
   */
  async list() {
    const { Me } = this.ctx.model;
    const meModel = await Me.findOne({}, 'skills');
    return meModel.skills
  }
}

module.exports = SkillsService;
